﻿using IM.Easy.Core.JsonConverter;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;

namespace IM.Easy.Core.Audit
{

    public class AuditableEntity : Auditable
    {
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主键KEY")]
        public virtual long Id { get; set; }
    }

    /// <summary>
    /// Guid主键
    /// </summary>
    public class AuditableGuidEntity : AuditableEntity<Guid>
    {

    }

    /// <summary>
    /// 雪花ID实体
    /// </summary>
    public class AuditSnowflakeEntity : AuditableEntity<long>
    {
        [SugarColumn(IsPrimaryKey = true, ColumnDescription = "主键KEY")]
        [JsonConverter(typeof(LongStringConverter))]
        public override long Id { get; set; }
    }

    public class AuditableEntity<T> : Auditable where T : struct
    {
        [SugarColumn(IsPrimaryKey = true, ColumnDescription = "主键KEY")]
        public virtual T Id { get; set; }
    }


}
